﻿using System;
using System.Collections.Generic;

namespace NDK.Motion.Card
{

    public interface ICard
    {
        bool CardInit(ref List<ICard> cards, Int32 mode = 0);
        bool CardInit(Int32 mode = 0);
        bool Finalize();


        bool Initialized { get; set; }
        /// <summary>
        /// 该卡总共有多少输入
        /// </summary>
        int InputCount { get; set; }
        /// <summary>
        ///  该卡总共有多少输出
        /// </summary>
        int OutputCount { get; set; }
        /// <summary>
        /// 卡的类型，下面枚举（CARD_TYPE）中列出
        /// </summary>
        string CardType { get; set; }
        /// <summary>
        /// 卡的名称，用户自定义，方便记忆和使用
        /// </summary>
        string CardName { get; set; }
        /// <summary>
        /// 卡号，设备初始化时分配，注意一定要对应上
        /// </summary>
        int CardID { get; set; }
        /// <summary>
        /// 获取input的值
        /// </summary>
        /// <param name="port"></param>
        /// <returns>获取成功为true，获取失败为false</returns>
        /// <Exception>异常抛出</Exception>
        bool GetDI(int port, int group = 0);
        /// <summary>
        /// 获取output的值
        /// </summary>
        /// <param name="port"></param>
        /// <returns>获取成功为true，获取失败false</returns>
        /// <Exception>异常抛出</Exception>
        bool GetDO(int port, int group = 0);
        /// <summary>
        /// 设置output的值，
        /// </summary>
        /// <param name="port"></param>
        /// <param name="ONOrOFF"></param>
        /// <returns>设置成功为true，设置失败false></returns>
        /// <Exception>异常抛出</Exception>
        bool SetDO(int port, int ONOrOFF, int group = 0);

        void UpdateSlaveResource(ref ICard card, Int32 mode = 0);
    }
    /// <summary>
    /// 所有的卡类型，
    /// </summary>
    public enum CARD_TYPE
    {
        ADLINK_2048,//凌华的脉冲卡
        ADLINK_833X,//凌华的总线卡
        ACS,
        M60,//凌臣的总线卡
        Beckoff,//倍福PLC
        ADLINK_IO_CARD,//来不规划的IO卡，PCI_7230、PCI_7432、PCI_7442
        UWC348A_IO_CARD//联盈IO卡

        //PCI_8392 = 0,
        //PCI_825x,
        //PCI_8154,
        //PCI_785X,
        //PCI_8158,
        //PCI_7856,
        //ISA_DPAC1000,
        //ISA_DPAC3000,
        //PCI_8144,
        //PCI_8258,
        //PCI_8102,
        //PCI_V8258,
        //PCI_V8254,
        //PCI_8158A,
        //PCI_20408C,
        //PCI_6208V,
        //PCI_6208A,
        //PCI_6308V,
        //PCI_6308A,
        //PCI_7200,
        //PCI_7230,
        //PCI_7233,
        //PCI_7234,
        //PCI_7248,
        //PCI_7249,
        //PCI_7250,
        //PCI_7252,
        //PCI_7296,
        //PCI_7300A_RevA,
        //PCI_7300A_RevB,
        //PCI_7432,
        //PCI_7433,
        //PCI_7434,
        //PCI_8554,
        //PCI_9111DG,
        //PCI_9111HR,
        //PCI_9112,
        //PCI_9113,
        //PCI_9114DG,
        //PCI_9114HG,
        //PCI_9118DG,
        //PCI_9118HG,
        //PCI_9118HR,
        //PCI_9810,
        //PCI_9812,
        //PCI_7396,
        //PCI_9116,
        //PCI_7256,
        //PCI_7258,
        //PCI_7260,
        //PCI_7452,
        //PCI_7442
    }
}
